{
 "metadata": {
  "name": "",
  "signature": "sha256:7654a287db2a53428bb31805e5793f229cbddd81ad89222d0b0bc6453baa2490"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Carbon Dioxide"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Carbon Dioxide - Fenghour, JPCRD, 1998  \n",
      "\n",
      "$\\eta^0 = \\dfrac{1.00697\\sqrt{T}}{\\sigma^2\\mathfrak{S}(T^*)}$\n",
      "\n",
      "$\\mathfrak{S}(T^*)=\\exp\\left(\\sum_{i=0}^{4}a_i[\\ln T^*]^i\\right)$ \n",
      "\n",
      "$\\Delta\\eta = d_{11}\\rho + d_{21}\\rho^2+\\frac{d_{64}\\rho^6}{(T^*)^3}+d_{81}\\rho^8+\\frac{d_{82}\\rho^8}{T^*}$ \n",
      "\n",
      "$\\Delta\\eta = d_{11}\\rho_c\\delta + d_{21}\\rho_c^2\\delta^2+\\frac{d_{64}\\rho_c^6(\\varepsilon/k)^3\\delta^6\\tau^3}{(T_c)^3}+\\rho_c^8d_{81}\\delta^8+\\frac{\\rho_c^8d_{82}\\delta^8(\\varepsilon/k)\\tau}{T_c}$"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Conversion back to C*sqrt(M*T) - back calculate C from constant in paper - using sigma = 1 nm so it cancels out\n",
      "1.00697e-6/(44.0098)**0.5"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "pyout",
       "prompt_number": 10,
       "text": [
        "1.5178953643112785e-07"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Convert the coefficients back to being a function of tau and delta rather than Tstar and rho\n",
      "e_k = 251.196 # K\n",
      "rhoc = 0.0440098*10624.9 # 467.69 # kg/m^3\n",
      "Tc = 304.107 # K\n",
      "d11 = 0.4071119e-2\n",
      "d21 = 0.7198037e-4\n",
      "d64 = 0.2411697e-16\n",
      "d81 = 0.2971072e-22\n",
      "d82 = -0.1627888e-22\n",
      "\n",
      "d11s = d11*rhoc/1e6\n",
      "d21s = d21*rhoc**2/1e6\n",
      "d64s = d64*rhoc**6*e_k**3/Tc**3/1e6\n",
      "d81s = d81*rhoc**8/1e6\n",
      "d82s = d82*rhoc**8*e_k/Tc/1e6\n",
      "\n",
      "print rhoc\n",
      "print [d11s, d21s, d64s, d81s, d82s]"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "467.59972402\n",
        "[1.9036541208525784e-06, 1.57384720473354e-05, 1.4207809578440784e-07, 6.79058431241662e-08, -3.0732988514867565e-08]\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import log, exp, sqrt\n",
      "def f(T):\n",
      "    Tstar = T/251.196\n",
      "    a = [0.235156, -0.491266, 0.05211155, 0.05347906, -0.01537102]\n",
      "    s = 0\n",
      "    for i in range(5):\n",
      "        s += a[i]*log(Tstar)**i\n",
      "    denom = exp(s)\n",
      "    return 1.00697*sqrt(T)/denom\n",
      "    \n",
      "f(800)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "pyout",
       "prompt_number": 18,
       "text": [
        "35.08566301618812"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Ammonia"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import log, exp, sqrt\n",
      "def f(T):\n",
      "    Tstar = T/386.0 #-\n",
      "    M = 17.03026 #kg/kmol\n",
      "    sigma = 0.2957 #nm\n",
      "    a = [4.99318220,-0.61122364,0.0,0.18535124,-0.11160946]\n",
      "    s = 0\n",
      "    for i in range(5):\n",
      "        s += a[i]*log(Tstar)**i\n",
      "    \n",
      "    denom = exp(s)*sigma**2\n",
      "    return 0.021357*sqrt(M*T)/denom\n",
      "    \n",
      "f(300)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "pyout",
       "prompt_number": 32,
       "text": [
        "0.10187645660601771"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import numpy as np\n",
      "-0.5*np.array(range(13))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "pyout",
       "prompt_number": 23,
       "text": [
        "array([-0. , -0.5, -1. , -1.5, -2. , -2.5, -3. , -3.5, -4. , -4.5, -5. ,\n",
        "       -5.5, -6. ])"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "$\\Delta\\eta = \\displaystyle\\sum_i \\left(\\displaystyle\\sum_{j}\\frac{d_{ij}}{(T^*)^j}\\right)\\rho^i= \\displaystyle\\sum_i \\displaystyle\\sum_{j}d_{ij}\\frac{(\\rho_c\\delta)^i(\\varepsilon/k)^j\\tau^j}{(T_c)^j}$\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# rho is units of mol/L, so convert the density to mol/L (poorly documented in paper)\n",
      "\n",
      "D = [(3,0,0.17366936e-8),\n",
      " (3,1,-0.64250359e-8),\n",
      " (2,2,2.19664285e-7),\n",
      " (4,2,1.67668649e-10),\n",
      " (4,3,-1.49710093e-10),\n",
      " (2,4,-0.83651107e-7),\n",
      " (4,4,0.77012274e-10)]\n",
      " \n",
      "e_k = 386.0\n",
      "rhoc = 225.0/17.03026\n",
      "Tc = 405.4\n",
      "v = []\n",
      "for i,j,dij in D:\n",
      "    v.append(dij*rhoc**i*(e_k/Tc)**j)\n",
      "print v"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "[4.005040600989671e-06, -1.4107915123955129e-05, 3.4760743039321816e-05, 4.631310990138071e-06, -3.937374461785061e-06, -1.200075068367531e-05, 1.9284977991745303e-06]\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "R123"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "$\\Delta\\eta = c_1\\rho+c_2T\\rho +a_1\\rho+a_2\\rho^2+a_3\\rho^3 + \\frac{a_0}{\\rho-\\rho_0}+\\frac{a_0}{\\rho_0}$\n",
      "\n",
      "$\\Delta\\eta = c_1\\rho_c\\delta+c_2T_c\\tau^{-1}\\rho_c\\delta +a_1\\rho_c\\delta+a_2\\rho_c^2\\delta^2+a_3\\rho_c^3\\delta^3 + \\frac{a_0/\\rho_c}{\\delta-\\delta_0}+\\frac{a_0/\\rho_c}{\\delta_0}$"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "rhoc = 550\n",
      "Tc = 456.831\n",
      "rho0 = 1828.263\n",
      "delta0 = rho0/rhoc\n",
      "c1 = rhoc*-2.226486e-2/1e6\n",
      "c2 = rhoc*Tc*5.550623e-5/1e6\n",
      "a0 = 3.222951e5/rhoc/1e6\n",
      "a1 = -1.009812e-1*rhoc/1e6\n",
      "a2 = 6.161902e-5*rhoc**2/1e6\n",
      "a3 = -8.84048e-8*rhoc**3/1e6\n",
      "print 'a',(c1,c2,a1,a2,a3)\n",
      "print 'a0',(a0)\n",
      "print 'delta0',(delta0)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "a (-1.2245673e-05, 1.3946331606421503e-05, -5.553966e-05, 1.863975355e-05, -1.47083486e-05)\n",
        "a0 0.000585991090909\n",
        "delta0 3.32411454545\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "R152a"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import numpy as np\n",
      "_E = [-0.0737927, 0.517924, -0.308875, 0.108049, -0.408387]\n",
      "E = (np.array(_E)*51.12e-6).tolist()\n",
      "E"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "pyout",
       "prompt_number": 5,
       "text": [
        "[-3.772282824e-06,\n",
        " 2.6476274880000003e-05,\n",
        " -1.578969e-05,\n",
        " 5.52346488e-06,\n",
        " -2.087674344e-05]"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Conversion back to C*sqrt(M*T) - back calculate C from constant in paper - using sigma = 1 nm so it cancels out\n",
      "0.2169614e-6/(66.05)**0.5"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "pyout",
       "prompt_number": 7,
       "text": [
        "2.6695992007227643e-08"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "368/66.05"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "pyout",
       "prompt_number": 8,
       "text": [
        "5.571536714610144"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Sulfur Hexafluoride"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import numpy as np\n",
      "Tc = 318.7232\n",
      "c = np.array([0.118561, -0.378103, 0.416428, -0.165295, 0.0245381])\n",
      "t = np.array([0,0.25,0.5,0.75,1])\n",
      "print (c*(1/Tc)**t/1e6).tolist()"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "[1.18561e-07, -8.948633138369e-08, 2.3325614004395283e-08, -2.191287992665495e-09, 7.698874760293571e-11]\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "R410A"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import numpy as np\n",
      "rhom = 459.0300696\n",
      "b = np.array([0,9.047e-3,5.784e-5,1.309e-7,-2.422e-10,9.424e-14,3.933e-17])/1e6\n",
      "t = np.array(range(7))\n",
      "print (b*rhom**t).tolist()"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "[0.0, 4.1528450396712e-06, 1.2187385701457372e-05, 1.2660855545258757e-05, -1.0753223728015742e-05, 1.9206178288211474e-06, 3.6793471063956824e-07]\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Conductivity\n",
      "import numpy as np\n",
      "rhom = 459.0300696\n",
      "b = np.array([3.576e-2,-9.045e-6,4.343e-8,-3.705e-12])/1e3\n",
      "t = np.array(range(1,5))\n",
      "print (b*rhom**t).tolist()"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "[0.016414915288896, -0.0019058593303886919, 0.00420061845936278, -0.0001644950202819914]\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "R407C"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Viscosity \n",
      "import numpy as np\n",
      "rhom = 453.43094\n",
      "b = np.array([0,-3.038e-3,2.927e-4,-9.559e-7,1.739e-9,-1.455e-12,4.756e-16])/1e6\n",
      "t = np.array(range(7))\n",
      "print (b*rhom**t).tolist()"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "[0.0, -1.3775231957200001e-06, 6.0179007998135324e-05, -8.911399521418381e-05, 7.350962141560484e-05, -2.788808852966893e-05, 4.133412533885438e-06]\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Conductivity\n",
      "import numpy as np\n",
      "rhom = 453.43094\n",
      "b = np.array([2.715e-2,4.963e-5,-4.912e-8,2.884e-11])/1e3\n",
      "t = np.array(range(1,5))\n",
      "print (b*rhom**t).tolist()"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "[0.012310650021, 0.010203909009044946, -0.004579223187488973, 0.001219101484546316]\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "R404A"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import numpy as np\n",
      "rhom = 482.162772\n",
      "b = np.array([0,2.260e-3,1.786e-4,-4.202e-7,8.489e-10,-8.670e-13,3.566e-16])/1e6\n",
      "t = np.array(range(7))\n",
      "print (b*rhom**t).tolist()\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "[0.0, 1.08968786472e-06, 4.152109565230651e-05, -4.710175334443676e-05, 4.588082670553865e-05, -2.2593706031401724e-05, 4.4806744468118286e-06]\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Conductivity\n",
      "import numpy as np\n",
      "rhom = 482.162772\n",
      "b = np.array([3.222e-2, 2.569e-5, -2.693e-8, 2.007e-11])/1e3\n",
      "t = np.array(range(1,5))\n",
      "print (b*rhom**t).tolist()"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "[0.01553528451384, 0.0059724353152729795, -0.0030186820979668776, 0.0010847310542822014]\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "R507A"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import numpy as np\n",
      "rhom = 490.74\n",
      "b = np.array([0,5.308e-4,2.234e-4,-6.742e-7,1.411e-9,-1.388e-12,5.274e-16])/1e6\n",
      "t = np.array(range(7))\n",
      "print (b*rhom**t).tolist()"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "[0.0, 2.60484792e-07, 5.380047201384e-05, -7.967886221772443e-05, 8.183382443771656e-05, -3.9504517246163185e-05, 7.366291094257731e-06]\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Conductivity\n",
      "import numpy as np\n",
      "rhom = 490.74\n",
      "b = np.array([2.799e-2, 3.065e-5, -3.644e-8, 2.609e-11])/1e3\n",
      "t = np.array(range(1,5))\n",
      "print (b*rhom**t).tolist()"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "[0.013735812600000001, 0.00738130916394, -0.004306582229626043, 0.0015131427920482105]\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "R134a"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Un reduced values\n",
      "b1 = 1.836526\n",
      "b2 = 5.126143\n",
      "b3 = -1.436883\n",
      "b4 = 0.626144\n",
      "# Reducing value \n",
      "lambda_red = 2.055e-3\n",
      "print [b1*lambda_red, b2*lambda_red, b3*lambda_red, b4*lambda_red]\n",
      "\n",
      "rhomass_red = 5.049886*102.032\n",
      "print rhomass_red"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "[0.0037740609300000003, 0.010534223865, -0.002952794565, 0.00128672592]\n",
        "515.249968352\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}